package com.example.demorocketmq.consumer;


import com.example.demorocketmq.UserInfo;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 普通消费
 *
 * 1实现RocketMQListener接口
 * 2申明泛型对象即业务对象
 * 3使用@RocketMQMessageListener注解
 * 4配置@RocketMQMessageListener注解,必须配置项入下group,topic
 * 5加上@Component注解或者子注解
 */
@Component
@RocketMQMessageListener(topic = "${topic.sendDataType}",consumerGroup="${group.consumer.sendDataType}")
public class SendDataTypeConsumer implements RocketMQListener<UserInfo>{

    @Override
    public void onMessage(UserInfo message) {
        System.out.println(String.format("consumer name is %s data is %s",this.getClass().getSimpleName(), message));
    }

}